package com.cdp.system.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.cdp.common.core.domain.entity.SysFlyashType;
import com.cdp.common.core.domain.entity.SysWaterReducerType;
import com.cdp.system.dto.StoneGrainDTO;
import com.cdp.system.mapper.SysFlyashTypeMapper;
import com.cdp.system.service.ISysFlyashTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 粉煤灰类型Service实现类
 */
@Service
public class SysFlyashTypeServiceImpl extends ServiceImpl<SysFlyashTypeMapper, SysFlyashType> implements ISysFlyashTypeService {

    @Autowired
    private SysFlyashTypeMapper sysFlyashTypeMapper;

    @Override
    public List<SysFlyashType> listflyashType() {
        List<SysFlyashType> list = list();
        return  list;
    }


    /**
     * 粉煤灰种类下拉模糊查询
     * @param stoneGrainDTO
     * @return
     */

    @Override
    public List<SysFlyashType> listFlyashType(StoneGrainDTO stoneGrainDTO) {
        LambdaQueryWrapper<SysFlyashType> wrapper = new LambdaQueryWrapper<>();
        // 如果传入的 name 不为空
        if (stoneGrainDTO.getName() != null && !stoneGrainDTO.getName().isEmpty()) {
            wrapper.like(SysFlyashType::getName, stoneGrainDTO.getName());
        }

        // 执行查询
        return sysFlyashTypeMapper.selectList(wrapper);

    }
}
